package net.ifilm.common;

import net.ifilm.domain.Message;

public final class Constants {

    private Constants() { }

    public static final int FILM_TYPE_ACTION    = 1;    // 动作
    public static final int FILM_TYPE_FUNNY     = 2;    // 喜剧
    public static final int FILM_TYPE_LOVEY     = 3;    // 爱情
    public static final int FILM_TYPE_TERRIFY   = 4;    // 惊悚
    public static final int FILM_TYPE_SIENCE    = 6;    // 科幻
    public static final int FILM_TYPE_SUSPENSE  = 7;    // 悬疑
    public static final int FILM_TYPE_RECORD    = 8;    // 记录
    public static final int FILM_TYPE_WAR       = 9;    // 战争
    public static final int FILM_TYPE_CARTOON   = 10;   // 动画
    public static final int FILM_TYPE_STORY     = 12;   // 故事
    public static final int FILM_TYPE_ETHICS    = 99;   // 伦理
    public static final int FILM_TYPE_DISASTER  = 100;  // 灾难

    public static final String KEY_XDDY = "xddy";

    public static final String SEPARATE = ";";

    public static final int CONNECT_TIMEOUT = 1000 * 60 * 3;


    /*
     * 任务队列
     */
    public static final Queue<Message> messageQueue = new Queue<Message>();

    /*
     * 压缩图片的默认宽度和高度
     */
    public static final int DEFAULT_FILM_IMAGE_WIDTH = 112;
    public static final int DEFAULT_FILM_IMAGE_HEIGHT = 160;


    // ------------------------------------------------------------------------------------------- common sql

    /*
     * 系统初始化缓存电影名称的SQL，排除电视剧、综艺片
     */
    public static final String FILMNAME_LIST = "SELECT f.filmname, count(1) nums FROM film f, filmpath fp "
            + "WHERE f.filmid = fp.filmid AND f.type != 2 AND f.type != 3 "
            + "GROUP BY f.filmname HAVING nums < 3";

    /*
     * 系统初始化缓存电影名称的SQL，电视剧、综艺片
     */
    public static final String REVERSE_FILMNAME_LIST = "SELECT f.filmname, f.filmid, count(1) nums "
            + "FROM film f, filmpath fp "
            + "WHERE f.filmid = fp.filmid AND f.type = 2 OR f.type = 3 "
            + "GROUP BY f.filmname HAVING nums >= 3";

    /*
     * 读取系统所有角色列表
     */
    public static final String FILMACTOR_LIST = "SELECT id, starname FROM star";

    /*
     * 查询已存在电影所有播放路径
     */
    public static final String FILMPATH_LIST = "SELECT ordernum, labeltitle FROM filmpath t WHERE t.filmid = ? "
            + "ORDER BY ordernum DESC";

    /*
     * 更新电影时间
     */
    public static final String UPDATE_FILM_TIME = "UPDATE film SET createtime = ? WHERE filmid = ?";
}
